function logValue(x: Date | string) {
    // x is type of `Date` 
    if (x instanceof Date) {
        x.toISOString();
    // here, x is type of `string` 
    } else {
        x.toUpperCase();
    }
}